<?php

namespace App\Validate\api;

use Illuminate\Foundation\Http\FormRequest;
use App\Validate\BaseValidate;

class ResourceValidate extends BaseValidate
{

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            //'uid'=>'required|integer',
            'type'=>'required|integer',
            'id'=>'required|integer',
            'is_open'=>'required|integer',
            'title'=>'required',
            'data'=>'required',
        ];
    }

    public function messages()
    {
        return [
            'type.required'=>'类型不能为空',
            'page.required'=>'页码不能为空',
            'id.required'=>'ID不能为空',
            'sid.required'=>'主库ID不能为空',
            'title.required'=>'标题不能为空',
            'type.integer'=>'类型必须为整数',
            'is_open.integer'=>'是否公开必须为整数',
            'is_open.required'=>'是否公开不能为空',
            'id.integer'=>'ID必须为整数',
            'data.required'=>'上传数据不能为空',
            'category.integer'=>'类型/标签必须为整数',
            'category.required'=>'类型/标签不能为空',
        ];
    }

    public $scenes = [
        'lists' => ['type'],
        'picInfo' => ['id'],
        'picture' => ['type','sid'],
        'rolePicture' => ['sid'],
        'upload'=>['type','title','is_open','data','category'],
        'tags'=>['category']
    ];
}
